﻿// <copyright file="TextPadLauncher.cs" company="Horiba Medical">
//     Copyright (c) Horiba Medical. All rights reserved.
// </copyright>
// <summary>
//     TextPad launcher.
// </summary>

namespace DoxyOutParser.Launcher
{
	using System.ComponentModel;
	using System.Diagnostics;

	/// <summary>
	/// Launches TextPad with a specified file at a specified line.
	/// </summary>
	internal class TextPadLauncher
	{
		/// <summary>
		/// Prevents a default instance of the TextPadLauncher class from being created.
		/// </summary>
		private TextPadLauncher()
		{
		}

		/// <summary>
		/// Launches TextPad with the appropriate arguments.
		/// </summary>
		/// <param name="fileName">The file to open.</param>
		/// <param name="line">The line to point to.</param>
		public static void Launch(string fileName, string line)
		{
			ProcessStartInfo startInfo = new ProcessStartInfo();
			startInfo.FileName = "C:\\Program Files\\TextPad 4\\TextPad.exe";
			startInfo.WindowStyle = ProcessWindowStyle.Hidden;
			startInfo.Arguments = fileName + "(" + line + ")";
			try
			{
				Process.Start(startInfo);
			}
			catch (Win32Exception exception)
			{
				throw new Win32Exception(exception.Message + ": " + startInfo.FileName);
			}
		}
	}
}
